import Field from 'winged/utils/wt-model-field'

export default {
	title: '入院记录',
	name: 'admission',
	tableName: 'hospitalized',
	single: true,
	query: {
		method: 'GET',
		url: 'doctor/patient/hospitalized',
		transfer: true,
		placeholder: '当前没有入院记录',
		extraParams: [
			'case_id',
		]
	},
	new: {
		method: 'POST',
		url: 'doctor/patient/hospitalized',
		transfer: true,
		extraParams: [
			'case_id',
		]
	},
	update: {
		method: 'PUT',
		url: 'doctor/patient/hospitalized',
		transfer: true
	},
	delete: {
		method: 'DELETE',
		url: 'doctor/patient/hospitalized',
		transfer: true
	},
	// 定义id字段
	id_field: {
		// 用于修改、删除操作的字段名
		name: 'hospitalize_id',
		// id字段查询结果中的tableName默认为'id'
		// tableName: 'id'
	},
	fields: [
		 {
			label: '入院时间',
			type: Field.types.date,
			display: true,
			name: 'admission_date',
			tableName: 'admissionDate',
			rules: [
				{ type: 'date', required: true, message: '请选择入院时间', trigger: 'blur' },
			]
		},{
			label: '年龄',
			type: Field.types.number,
			unit: '岁',
			display: true,
			summary: true,
			readonly: true,
			name: 'patient_age',
			formSize: 'mini',
			tableName: 'patientAge',
			customComponent: 'wt-case-admission-date',
			dependingField:{
				name: 'admissionDate',
				message: '请先选择住院时间',
			},
			rules: [
				{ required: true, type:'number', message: '请填入正确的入院时间，计算入院年龄' },
			]
		}, {
			label: '主诉',
			type: Field.types.textarea,
			display: true,
			name: 'self_reported_symptom',
				tableName: 'selfReportedSymptom'
		},{
			label: '现病史',
			type: Field.types.textarea,
			display: true,
			summary: true,
			name: 'present_history',
			tableName: 'presentHistory'
		}, {
			label: '既往史',
			type: Field.types.textarea,
			display: true,
			summary: true,
			name: 'past_history',
			tableName: 'pastHistory'
		},{
			label: '备注',
			type: Field.types.textarea,
			display: true,
			name: 'comment',
			tableName: 'comment'
		}, {
			label: '图片',
			type: Field.types.images,
			saveAsJson: true,
			display: true,
			summary: true,
			uploadByComponent: true,
			preSubmit: true,
			name: 'image_urls',
			tableName: 'hospitalizeImage',
		}
	]
};